<template>
  <div>
  <el-form :label-position="labelPosition" style="margin: 20px 150px 0px 100px; height: auto" ref="form" :model="form" label-width="80px">
    <el-form-item label="员工名" required>
      <el-input v-model="form.sName"></el-input>
    </el-form-item>

    <el-form-item label="员工id" required>
      <el-input v-model="form.sId"></el-input>
    </el-form-item>

    <el-form-item label="昵称" required>
      <el-input v-model="form.sUsername"></el-input>
    </el-form-item>
    <el-form-item label="设置密码" required>
      <el-input v-model="form.sPwd" type="password"></el-input>
    </el-form-item>
  </el-form>
  <el-form :inline="true" style="margin:0px 310px 0px 0px; height: auto" ref="form" :model="form" label-width="80px">
    <el-form-item label="类型" required>
      <el-select v-model="form.sType" placeholder="请选择员工性别">
        <el-option label="模型主管" value="1"></el-option>
        <el-option label="渲染主管" value="2"></el-option>
        <el-option label="后期主管" value="3"></el-option>
        <el-option label="模型生手" value="4"></el-option>
        <el-option label="渲染生手" value="5"></el-option>
        <el-option label="后期生手" value="6"></el-option>
        <el-option label="模型熟手" value="7"></el-option>
        <el-option label="渲染熟手" value="8"></el-option>
        <el-option label="后期熟手" value="9"></el-option>
        <el-option label="前台人员" value="10"></el-option>
      </el-select>
    </el-form-item>

    <el-form-item label="性别">
      <el-select v-model="form.sSex" placeholder="请选择员工类型">
        <el-option label="男" value="male"></el-option>
        <el-option label="女" value="famale"></el-option>
      </el-select>
    </el-form-item>
  </el-form>
  <el-form :label-position="labelPosition" style="margin: 20px 150px 0px 100px; height: auto" ref="form" :model="form" label-width="80px">
    <el-form-item label="身份证号" required>
      <el-input v-model="form.sIdNumber"></el-input>
    </el-form-item>

    <el-form-item label="住址">
      <el-input v-model="form.sAddress"></el-input>
    </el-form-item>

    <el-form-item label="联系电话" required>
      <el-input v-model="form.sTel"></el-input>
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="onSubmit">确认</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</div>
</template>

<script>
  import Global from '../../utils/global'
  export default {
    name: 'ProManAddStaff',
    data(){
      return{
        labelPosition:"right",
        glo:new Global,
        form: {
          sName:null,
          sId:null,
          sUsername: null,
          sPwd:null,
          sType:null,
          sSex: null,
          sIdNumber:null,
          sAddress: null,
          sTel: null,
        }
      }
    },
    methods:{
      onSubmit() {
        console.log('submit!');
        var staff = this.form
        staff.sId = eval(staff.sId)
        staff.sType = eval(staff.sType)
        this.glo.sendDate(this.glo.server + "frontDesk/addStaff", staff, this.handleAddStaff,"POST")
      },
      handleAddStaff(res){
        console.log(res);
        let feedBack = eval(res);
        if (feedBack.success == false) {//登录失败
          this.$message.error(feedback.message);
          return;
        }
        this.$message.success("员工添加成功√")
        return;
      }
    },
  }
</script>

<style scoped>

</style>
